package com.cs456.TeamBobcat;

import com.cs456.TeamBobcat.database.MyDB;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class WhatDidTheySayResult extends Activity {
	TextView _resultText;
	Button _homeButton;
	MyDB dba;
	String _path;
	String _result;
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.textresult);
		dba = new MyDB(this);
		dba.open();
		
		initText();
		initHomeButton();
	}
	
	private void initText()	{
		_resultText = (TextView) findViewById(R.id.WAIResult_Text);
		
		Intent intent = getIntent();
		_result = intent.getStringExtra(WebService.WHAT_DID_THEY_SAY_RESULT_KEY);
		_path = intent.getStringExtra("audioPath");
		_resultText.setText(_result);
		dba.insertAudio(_path, _result);
		dba.close();
		
	}
	
	private void initHomeButton(){
		_homeButton = (Button) findViewById(R.id.WAIResult_Home);
		_homeButton.setOnClickListener(new OnClickListener(){
			public void onClick(View v){
				finish();
			}
		});
	}
	
	
}
